package com.ruoyi.business.domain;


import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.SysUser;
import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "carmain")
@Data
public class CarMain extends BaseEntity {

    private static final long serialVersionUID = 855066681155L;

    /**
     *
     */
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;


    @OneToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "user_id", foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
    @NotFound(action = NotFoundAction.IGNORE)
    private SysUser userId;

    @Transient
    private List<Cardetail> cardetails;

    public CarMain() {
        super();
    }

    public CarMain(SysUser userId) {
        this.userId = userId;
    }

}
